<?php
class AnyClass
{
public $subClass;
public $number;
public function __construct($n)
{
$this->number = $n;
}
}
$class1 = new AnyClass(1);
$class2 = new AnyClass(2);
$class3 = new AnyClass(3);
$class1->subClass = $class2;
$class2->subClass = $class3;
echo $class1->subClass->subClass->number;
// same as
// ( ($class1->subClass)->subClass)->number;
// ( $class2 ->subClass)->number;
// $class3->number;
1